/**
 * option{title:"删除确认",content:"您确定要删除该条数据吗?"}
 */
angular.module('mamApp').controller('ModalInstanceCtrl', ['$scope', '$uibModalInstance', 'options','$sce' ,function ($scope, $modalInstance, options,$sce) {
    $scope.options =angular.copy(options) ;
    $scope.options.message=$sce.trustAsHtml($scope.options.message);
    $scope.ok = function () {
        $modalInstance.close('ok');
    };
    $scope.other = function () {
        $modalInstance.close('other');
    };

    $scope.cancel = function () {
        $modalInstance.close('cancel');
    };
}]).factory('ImsDialog', ['$uibModal', function ($uibModal) {
    var dialog = {
        "CONFIRM": {"type": "CONFIRM", "title": "确认", "message": "确认？"},
        "MESSAGE": {"type": "MESSAGE", "title": "提示", "message": "提示?"}
    };
    dialog.open = function (dialogOption) {
        var modalInstance = $uibModal.open({
            animation: true,
            size: 'normal',
            openedClass:"modal-open-normal"  ,
            templateUrl: 'ims-dialog.html',
            controller: 'ModalInstanceCtrl',
            resolve: {
                options: function () {
                    return dialogOption;
                }
            }
        })
       return modalInstance.result;
    };
    return dialog;
}]);
